﻿using Sidvall.Data;

namespace Sidvall.IO
{
    public sealed class Folder : IItem
    {
        #region Public Members

        public string FullName { get; set; }
        public string StorageName { get; set; }
        public string Name { get; set; }
        public System.DateTime? CreationTime { get; set; }
        public System.DateTime? LastWriteTime { get; set; }

        #region Copy

        public Folder Copy()
        {
            return new Folder()
            {
                CreationTime = this.CreationTime,
                FullName = this.FullName,
                LastWriteTime = this.LastWriteTime,
                Name = this.Name,
                StorageName = this.StorageName,
            };
        }

        #endregion
        #region ToString

        public override string ToString()
        {
            return this.FullName;
        }

        #endregion

        #region IItem Members

        string IItem.Id
        {
            get
            {
                return this.FullName;
            }
        }
        string IItem.Name
        {
            get
            {
                if (!string.IsNullOrWhiteSpace(this.Name))
                    return this.Name;
                return this.FullName;
            }
        }

        #endregion

        #endregion
        #region Constructors

        public Folder()
        {
        }

        #endregion
    }
}
